const prog_uchar sig_pattern[16][50] PROGMEM = {
//   output 1  (main)        output  2 (nav)      output 3 (gps)       output 4 (aux)             buzzer
//  0 1 2 3 4 5 6 7 8 9   0 1 2 3 4 5 6 7 8 9   0 1 2 3 4 5 6 7 8 9   0 1 2 3 4 5 6 7 8 9   0 1 2 3 4 5 6 7 8 9	          counter position

  { 0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0}, 	// 0 (All-Off)
  { 1,1,0,0,1,1,0,0,1,1  ,0,0,0,0,0,0,0,0,0,0  ,1,1,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0}, 	// 1 (Disarmed - no GPS fix)
  { 1,1,1,1,1,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,1,1,1,1,1,1,1,1,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0}, 	// 2 (Disarmed - GPS fix)
  { 1,1,1,1,1,1,1,1,1,1  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0}, 	// 3 (Armed)		
  { 1,1,1,1,1,1,1,1,1,1  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0}, 	// 4 (Flying)
  { 1,1,1,1,1,1,1,1,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0}, 	// 5 (HeadingFree)
  { 1,1,1,1,1,1,1,1,1,1  ,1,0,0,0,0,1,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0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1,0,0,0,0,0,0,0}, 	// 14 (Arming)		
  { 1,1,1,1,1,1,1,1,1,1  ,1,1,1,1,1,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,0,0,0,0,0,0,0,0  ,0,0,1,0,0,0,0,0,0,0}, 	// 15 (Disarming)		

};

//void initLeds() {
//  /* Initialize output pins */
//  for(int pos = 0; pos <= maxLed; pos++) {
//    pinMode(Out[pos],OUTPUT);
//  }
//}

int Out[] = {17,19,18,9,8};
static uint8_t ioCounter = 0;
#define patNo       10
#define maxLed      4

void signalingWriteLeds(int statusId) {
  for(int pos = 0; pos <= maxLed-1; pos++) {
    digitalWrite (Out[pos], pgm_read_byte (&sig_pattern[statusId][(patNo*pos)+ioCounter]));
  }
}
